home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Programmer's Power Pack
/
Delphi Volume 1.iso
/
e_to_l
/
fbuilder
/
delphi
/
fb_rtti.int
< prev
next >
Wrap
Text File
|
1996-09-15
|
5KB
|
127 lines
{$F+}
{*
* FormulaBuilder 1.0
* Delphi 1.0 RTTI Unit
* Copyright (c) 1995, 1996 Clayton Collie
* All Rights Reserved
*
* Use is authorized only in accordance with a
* valid FormulaBuilder License agreement
*
*}
unit fb_rtti;
INTERFACE
uses typinfo,sysutils,classes,forms;
CONST
RTTI_INVALID_OBJECT = 210;
RTTI_INVALID_PROPERTY = 211;
RTTI_INVALID_PROPVALUE = 212;
RTTI_INVALID_PROPPATH = 213;
RTTI_PROP_READONLY = 214;
Type
RTTIError = Class(Exception)
public
Constructor Create( ecode : integer );
Property ErrorCode : integer read fErrorCode write fErrorCode;
end;
TInstanceProperty = Class(TObject)
Private
{* Unlisted *}
Public
Constructor Create;
Constructor CreateFull(anInstance : TObject;APropInfo : PPropInfo);
Constructor CreateFromPath(root : TObject; PropPath : String);
Constructor CreateFromSearch(root : TObject;Const Propname : string;kinds : TTypeKinds);
procedure SetEvent(ComponentWithHandler : TComponent;const Handler : string);
{Procedure Assign(const newInstance : TInstanceProperty);}
Property AsChar : char read getAsChar write setFromChar;
Property AsFloat : extended read getAsFloat write setFromFloat;
Property AsInteger : longint read getAsInteger write setFromInteger;
Property AsBoolean : boolean read getAsBoolean write setFromBoolean;
Property AsMethod : TMethod read getAsMethod write setFromMethod;
Property AsObject : TObject read getAsObject write setFromObject;
Property AsString : String read getStringValue write setPropFromString;
Property Typename : string read getTypename;
Property TypeData : PTypeData read getTypeData;
Property IsBoolean : boolean read getIsBoolean;
Property Instance : TObject read fInstance write setInstance;
Property IsReadOnly : boolean read getIsReadonly;
Property IsStored : boolean read getIsStored;
Property isDefault : boolean read getisDefault;
Property Kind : TTypeKind read getKind;
Property PropInfo : PPropInfo read fPropInfo;
Property Propname : string read getname write setName;
end;
TFBPropData = TInstanceProperty;
Function DescendsFrom(Ancestor : TObject;Test : TObject):Boolean;
{ Can we assign class2 to class1 ? }
Function ClassAssignmentCompatible(Class1 , Class2 : TObject):boolean;
procedure SetEvent( ComponentWithEvent : TComponent ;
const Event : string ;
ComponentWithHandler : TComponent ;
const Handler : string ) ;
Procedure GetProperties(AObj : TObject;
TypeKinds : TTypeKinds;
AList : TStrings;
iIndentLevel : Integer);
Procedure GetComponentProperties(AObject : TComponent;
TypeKinds : TTypeKinds;
AList : TStrings;
iIndentLevel : integer);
Procedure FreePropertyData( AList : TStrings );
function EnumValue(EnumType: PTypeInfo; const EnumName: string): Integer;
{* *}
{ Do a recursive search from ROOT downward to see if EnumName exists }
{ as one of the members of an enumeration type }
{ If root is a component, search component list recursively also }
{ Returns its ordinal value }
{* *}
Function FBGetEnumValue(Root : TObject;
Const EnumName : String;
var Instance : TObject;
var EnumTypeInfo : PTypeInfo):integer;
{* *}
{ Do a recursive search from ROOT downward to see if PropName exists }
{ as one of the members of an object }
{ If root is a component, search component list recursively also }
Function FindPropInfo(Root : TObject;
Const PropName : String;
Const Kinds : TTypeKinds;
var Instance : TObject;
var APropInfo : PPropInfo):boolean;
{* Return Property info for a property given its Path from Root *}
Function GetPropFromPath(Root : TObject;
PropPath : string;
var Instance : TObject) : PPRopInfo;
{ This function expects a list of identifiers separated by commas }
Function StringSetToInt(root : TObject;SetString : String) : Cardinal;
Function GetRTTIErrorText(ecode : integer):string;
procedure PropValueError;
procedure PropertyNotFound;
procedure PropPathError;
Procedure InvalidPropertyError;
Procedure PropReadOnlyError;
IMPLEMENTATION
END.